* - "label": a user-visible string to use as section heading
* - "display-hint": a string used to determine special formatting for the section.
* Possible values include "horizontal-buttons".
+ * - "text-direction": a string used to determine the #GtkTextDirection to use
+ * when "display-hint" is set to "horizontal-buttons". Possible values
+ * include "rtl", "ltr", and "none".
*
* The following attributes are used when constructing submenus:
* - "label": a user-visible string to display
GtkMenuSectionBox *box;
const gchar *label;
const gchar *hint;
+ const gchar *text_direction;
box = g_object_new (GTK_TYPE_MENU_SECTION_BOX, NULL);
box->toplevel = parent->toplevel;
label = gtk_menu_tracker_item_get_label (item);
hint = gtk_menu_tracker_item_get_display_hint (item);
+ text_direction = gtk_menu_tracker_item_get_text_direction (item);
if (hint && g_str_equal (hint, "horizontal-buttons"))
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (box->item_box), GTK_ORIENTATION_HORIZONTAL);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (box->item_box)), GTK_STYLE_CLASS_LINKED);
box->iconic = TRUE;
+
+ if (text_direction)
+ {
+ GtkTextDirection dir = GTK_TEXT_DIR_NONE;
+
+ if (g_str_equal (text_direction, "rtl"))
+ dir = GTK_TEXT_DIR_RTL;
+ else if (g_str_equal (text_direction, "ltr"))
+ dir = GTK_TEXT_DIR_LTR;
+
+ gtk_widget_set_direction (GTK_WIDGET (box->item_box), dir);
+ }
}
if (label != NULL)
return display_hint;
}
+const gchar *
+gtk_menu_tracker_item_get_text_direction (GtkMenuTrackerItem *self)
+{
+ const gchar *text_direction = NULL;
+
+ g_menu_item_get_attribute (self->item, "text-direction", "&s", &text_direction);
+
+ return text_direction;
+}
+
GMenuModel *
_gtk_menu_tracker_item_get_link (GtkMenuTrackerItem *self,
const gchar *link_name)
const gchar * gtk_menu_tracker_item_get_display_hint (GtkMenuTrackerItem *self);
+const gchar * gtk_menu_tracker_item_get_text_direction (GtkMenuTrackerItem *self);
+
GtkActionObservable * _gtk_menu_tracker_item_get_observable (GtkMenuTrackerItem *self);
gboolean gtk_menu_tracker_item_get_is_separator (GtkMenuTrackerItem *self);